import { ensureConfigInitialized, serviceUrl } from '../config/config'
import log from '../logger'
import request from './request'
import fs from 'fs'

export async function convertSrt(param) {
  // 确保配置初始化完成
  await ensureConfigInitialized();

  const kpopBaseUrl = serviceUrl.kpopBaseUrl;

  // log.debug('~ convertSrt ~ param:', JSON.stringify(param))

  // fs.writeFileSync("D:\\Users\\LT08\\Desktop\\1212.txt", JSON.stringify(param), 'utf8')

  // return request.post(`${kpopBaseUrl}:5000/api/tools/aligned_segments`, param)
  return request.post(`${kpopBaseUrl}:5000/api/tools/aligned_segments`, param)
}
